home *** CD-ROM | disk | FTP | other *** search
/ Programmers Heaven 2 / Programmers Heaven 2.iso / files / graphics / library / wgt51_r2.zip / WGT5 / EXAMPLES / WGT10.C < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-03  |  2.4 KB  |  76 lines

  1. /*
  2. ==============================================================================
  3.                       WordUp Graphics Toolkit Version 5.0                     
  4.                              Demonstration Program 10                         
  5.                                                                               
  6.  Shows the difference between normal and xray putblock modes                 
  7.  and demonstrates the flipblock procedure.                                   
  8.                                                                               
  9.  *** PROJECT ***                                                             
  10.  This program requires the file WGT5_WC.LIB to be linked.                    
  11.                                                                               
  12.  *** DATA FILES ***                                                          
  13.  NONE                                                                        
  14.                                                            WATCOM C++ VERSION 
  15. ==============================================================================
  16. */
  17.  
  18. #include <wgt5.h>
  19.  
  20.  
  21. void main(void)
  22. {
  23.   short i,x,y;
  24.   short oldmode;
  25.   color palette[256];
  26.   block part1;                    /* part of the screen */
  27.   
  28.   printf ("WGT Example #10\n\n");
  29.   printf ("This program will use wflipblock to paste a bitmap onto the screen in various.\n");
  30.   printf ("orientations. Press a key to advance to the next image each time.\n");
  31.   printf ("\n\nPress any key to continue.\n");
  32.   getch ();
  33.  
  34.   if ( !vgadetected () )
  35.   {
  36.     printf("Error - VGA card required for any WGT program.\n");
  37.     exit (0);
  38.   }
  39.   oldmode = wgetmode ();
  40.   vga256 ();
  41.  
  42.   for (y = 40; y >= 4; y--)
  43.   {
  44.     wfill_circle (y + 40, y + 10, y);      /* draw a pattern */
  45.     wsetcolor (y + 20);
  46.   }
  47.  
  48.   part1 = wnewblock (0, 0, 160, 100);       /* get the circle in a block */
  49.   wcls (0);
  50.  
  51.   for (x = 0; x < 320; x++)
  52.   {
  53.     wsetcolor (x);
  54.     wline (x, 0, x, 199);
  55.   }
  56.  
  57.   getch ();
  58.   wputblock (160, 0, part1, 0);             /* normal mode */
  59.   wflipblock (part1, 0);
  60.  
  61.   getch ();
  62.   wputblock (160, 100, part1, 1);           /* XRAY mode */
  63.   wflipblock (part1, 1);
  64.  
  65.   getch ();
  66.   wputblock (0, 100, part1, 0);             /* normal mode */
  67.   wflipblock (part1, 0);
  68.  
  69.   getch ();
  70.   wputblock(0, 0, part1, 1);               /* XRAY mode */
  71.  
  72.   getch ();
  73.   wfreeblock (part1);
  74.   wsetmode (oldmode);
  75. }
  76.